<?php

declare(strict_types=1);

namespace app\backend\listener;

use app\common\service\sys\UserService;
use app\common\service\sys\LogService;

/**
 * 用户日志
 */
class UserLog
{
  /**
   * 事件监听处理
   * @return mixed
   */
  public function handle($event)
  {
    list($user, $node, $time, $ip, $action, $content) = $event;
    (new LogService())->add([
      'uid' => $user['id'],
      'un' => $user['un'],
      'node' => $node,
      'create_time' => $time,
      'ip' => $ip,
      'action' => $action,
      'content'  => $content,
    ]);
  }
}
